mod command_interaction;
mod read_file;
mod create_micro;
mod create_h5;

use std::io::{Error, Read};
use std::path::Path;
use serde::Deserialize;
use command_interaction::ProjectType;

fn main() -> Result<(), Box<dyn std::error::Error>> {
   let project_info = command_interaction::command_interaction().expect("输入错误");

   // // 构建YAML文件的路径
   let path = Path::new("conf.yaml");
   let config: read_file::Config = read_file::read_file(path)?;

   match project_info.project_type {
      ProjectType::Micro => {
         create_micro::create_micro(project_info.project_name, config.git.micro)?;
      }
      ProjectType::H5 => {
         create_h5::create_h5(project_info.project_name, config.git.h5);
      }
   }

   Ok(())
}